﻿--[[
   @brief    descprtion: badge_points_control
   @author   hanmanhuang
   @version  1.0
   @date     2016-12-27
--]]

badge_points_control = 
{
    page_info = {};

    init = function()
        badge_points_control.inner_log("badge_points_control init");
        ierd_tgp.tpf_ui.Require("badge\\badge_points\\view.lua");
    end;

    inner_log = function (msg, core_msg)
        base_utility.log(string.format("[badge_points_control] %s", msg), core_msg);
    end;

    get_page_url = function()
        local url = badge_model.get_badge_points_page_url(badge_points_control.page_info);
        local url_login = web_utility.make_login_status_url(url, login_model.main_uin);
        return url_login;
    end;

    open_win = function(page_info)
        badge_points_control.page_info = page_info;
        badge_points_view.open_page();
    end;

    close_wnd = function()
        badge_points_control.page_info = {};
        badge_points_view.close_page();
    end;

    on_document_complete = function()
        --badge_points_view.show_page();
        badge_points_view.show_web_ctn(true);
    end;

    on_js_callback = function(uilib, fuc_name, json)
        badge_points_control.inner_log("on_js_callback.fuc_name="..fuc_name);
        if fuc_name == "close_window" then
            badge_points_control.close_wnd();
        elseif fuc_name == "close_dlg" then
            badge_points_control.close_wnd();
        else 
            badge_points_control.inner_log("on_js_callback other event!");
        end;
    end;
};

badge_points_control.init();